#define FEQUAL(x,y) (fabs((x)-(y))<=1e-8)
#define ABS(x)   ((x)<0?-(x):(x))
void search(int total,int money,double fx,double fy,double fz)
{
    int x,y,z;
    for(x=0;x<=total;x++)
    {
        for(y=0;y<=total-x;y++)
        {
            z=total-x-y;
            if(FEQUAL(x*fx+y*fy+z*fz,money))
                printf("%d %d %d\n",x,y,z);
        }
    }
}

int main()
{
    search(100,100,3,2,1./2);//p04
    search(100,100,2,4,2./9);//p05
    search(30,50,3,2,1);//p20
    return 0;
}
